from urllib.request import urlopen
from bs4 import BeautifulSoup
import re

html = urlopen('https://en.wikipedia.org/wiki/Kevin_Bacon')
bsObj = BeautifulSoup(html, 'html.parser')
tags = bsObj.find('div', {'id': 'bodyContent'}).find_all('a', {'href': re.compile("^(/wiki/)((?!:).)*$")})
for link in tags:
    if 'href' in link.attrs:
        print(link.attrs['href'])
